<?php

include_once("../controller/campus_controller_class.php");

$campus = $_POST['camp'];
$cep = $_POST['cep'];
$num = $_POST['num'];

if(empty($campus)){
    echo "<script>alert('Preencha o campus')</script>";
}elseif(empty($cep)){
    echo "<script>alert('Preencha o cep')</script>";
}elseif(empty($num)){
    echo "<script>alert('Preencha o num')</script>";
}else{
    
    $objCampus = new CampusController();
    $ok = $objCampus->cadastrar($cep, $campus, $num);
    if($ok == 1){
        $listCampus = $objCampus->selecionarJSON();

        echo json_encode($listCampus);
    }
}

